home *** CD-ROM | disk | FTP | other *** search
- unit NewGridTestU;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, Db, Grids, DBGrids, DBTables, NewDBGrid, ComCtrls, NewGrid;
-
- type
- TForm1 = class(TForm)
- Table1: TTable;
- DBGrid1: TNewDBGrid;
- DataSource1: TDataSource;
- chkIndicator: TCheckBox;
- chkVertLine: TCheckBox;
- procedure DBGrid1Resizing(Sender: TCustomDBGrid; Column: TColumn;
- Width: Cardinal);
- procedure DBGrid1Resized(Sender: TCustomDBGrid; Column: TColumn;
- Width: Cardinal);
- procedure chkIndicatorClick(Sender: TObject);
- procedure chkVertLineClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
-
- procedure TForm1.DBGrid1Resizing(Sender: TCustomDBGrid; Column: TColumn;
- Width: Cardinal);
- begin
- if Assigned(Column) then
- Caption := Format(
- 'Field %s is being resized to %d pixels',
- [Column.FieldName, Width])
- end;
-
- procedure TForm1.DBGrid1Resized(Sender: TCustomDBGrid; Column: TColumn;
- Width: Cardinal);
- begin
- if Assigned(Column) then
- Caption := Format(
- 'Field %s has been resized to %d pixels',
- [Column.FieldName, Width]);
- //Give clear indication that the resize has finished
- Color := Random($1000000)
- end;
-
- procedure TForm1.chkIndicatorClick(Sender: TObject);
- begin
- if chkIndicator.Checked then
- DBGrid1.Options := DBGrid1.Options + [dgIndicator]
- else
- DBGrid1.Options := DBGrid1.Options - [dgIndicator]
- end;
-
- procedure TForm1.chkVertLineClick(Sender: TObject);
- begin
- if chkVertLine.Checked then
- DBGrid1.Options := DBGrid1.Options + [dgColLines]
- else
- DBGrid1.Options := DBGrid1.Options - [dgColLines]
- end;
-
- end.
-